package com.piece.mall.service;

import com.piece.core.jpa.repository.BaseService;
import com.piece.mall.model.OmsOrderReturnApply;
import com.piece.mall.repository.OmsOrderReturnApplyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;

@Service
@Transactional
public class OmsOrderReturnApplyService extends BaseService<OmsOrderReturnApply, String> {

    @Autowired
    private OmsOrderReturnApplyRepository omsOrderReturnApplyRepository;

    @PostConstruct
    public void initRepository() {
        setRepository(omsOrderReturnApplyRepository);
    }

    public void changeStatus(Long id, String type) {
        omsOrderReturnApplyRepository.updateByProperties("id", id, "status", type);
    }
}
